package logic

import (
	"bilibili/bilibilirpc/bilibilirpc"
	"context"

	"bilibili/api/internal/svc"
	"bilibili/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type UserRealnameAddLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewUserRealnameAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserRealnameAddLogic {
	return &UserRealnameAddLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *UserRealnameAddLogic) UserRealnameAdd(req *types.UserRealnameAddRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	add, err := l.svcCtx.BilibiliRpc.UserRealnameAdd(l.ctx, &bilibilirpc.UserRealnameAddRequest{
		Name:     req.Name,
		IdCard:   req.IdCard,
		Status:   req.Status,
		UserId:   req.UserId,
		Password: req.Password,
		Mobile:   req.Mobile,
	})
	if err != nil {
		return &types.Response{
			Code:    500,
			Message: err.Error(),
			Data:    nil,
		}, nil
	}
	return &types.Response{
		Code:    200,
		Message: "查询成功",
		Data:    add,
	}, nil
}
